(function () {
    'use strict';

    // Usage:
    //
    // Creates:
    //

    angular
        .module('yky.components')
        .component('main', {
            template: `<nav class="navbar navbar-default navbar-fixed-top bg-dark box-shadow-lg" role="navigation">
	<div class="container-fluid">
		<!-- Brand and toggle get grouped for better mobile display -->
		<div class="navbar-header">
			<a ui-sref="admin.orgs" class="navbar-brand"><span class="text-white">艺考云平台</span></a>
		</div>

		<!-- Collect the nav links, forms, and other content for toggling -->
		<div class="collapse navbar-collapse">
			<ul class="nav navbar-nav">

				<li ng-repeat="m in vm.menus" class="" ui-sref-active="active"><a ui-sref="{{m.state}}">{{m.name}}</a></li>

			</ul>

			<ul class="nav navbar-nav navbar-right">
                <li class="m-r"><a >{{vm.user.org}}</a></li>
				<li class="m-r">
					<a class="" ><i class="fa fa-user"></i>&nbsp;{{vm.user.name}}</a>
				</li>
			</ul>
		</div>
		<!-- /.navbar-collapse -->
	</div>
	<!-- /.container-fluid -->
</nav>
<div style="padding-top:50px;" class="h-full" ui-view></div>
`,
            //templateUrl: 'templateUrl',
            controller: HeaderController,
            controllerAs:'vm',
            bindings: {
                Binding: '='
            }
        });

    HeaderController.inject = ['$http'];
    function HeaderController($http) {
        var vm = this;
        $http
            .get('/data/orgUser.json')
            .then(res => {
                vm.user = res.data;
            })
        vm.menus = [
            {
                name: '考试详情',
                state: 'main.exam'
            }, {
                name: '考试分析',
                state: 'main.analysis'
            }, {
                name: '学生管理',
                state: 'main.students'
            }, {
                name: '用户管理',
                state: 'main.orgUsers'
            }
        ]
        ////////////////

        vm.onInit = function () {};
        vm.onChanges = function (changesObj) {};
        vm.onDestory = function () {};
    }
})();